package com.atguigu.gmall.item.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author 李旭
 * @date 2022/1/11 10:01
 * @Description:
 *
 *  线程池配置类
 */
@Configuration
public class ThreadPoolConfig {

    //实例化  ： 将Bean 放入SpringIOC容器过程 叫
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        return new ThreadPoolExecutor(
                10,
                15,
                5,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10)
        );
    }
}
